Command-line interpreters or shell processors are a common way to interact with a computer system. Commands are entered as a sequence of typed characters (e.g., text and control characters) from a keyboard, and output is then received as a string of text. Such sequences typically take on the form of “do something”, “how”, and “to what”. In effect, the do something is a verb, how an adverb (e.g., should the command be executed “verbosely” or “quietly”), and the to what typically refers to one or more files on which the command should act. Included within these command sequences may be other characters such as inputs to the command, redirection characters to indicate where to route output, as well as other control characters.
Command-line interfaces were some of the very first interactive interfaces in use. In spite of the advent of the graphical user interface (GUI), command-line shells remain critical administrative tools because the user commands can be easily batched to automatically perform more complex tasks without the user interaction. The modern operating systems support a number of command-line interpreters that allow users to interact with the system by entering commands from the keyboard and examining the text output, either directly or with the help of utilities built into the shell or which are designed to interact with it. They also allow the sequences of commands be executed on behalf of the user in the batch mode.
As mentioned above, historically such shell command processors are character-oriented. This means that the shell command processor accepts character-by-character input from the user, waiting for a specific character (e.g., “Carriage return” or “Enter”) to signal that the shell should examine the input and try to execute it. When this character is supplied, the processor parses the input, determines if it is a legal command and begins executing it. If it is not a legal command, then an error is usually returned. If it is a legal command, then the command executes and may generate character output of its own, which can be examined by the operator.
The paradigm employed by the user is typically then to “open” the shell, supply characters to it via the keyboard and whenever the shell receives as input the Enter key (or other appropriate character depending on the syntax used), it attempts to process all characters it has received so far as a unit. Once the shell processor executes each unit as a command, it then reports the output. If an erroneous input was encountered, the processor may return a set of characters to the user which includes an error message. This cycle then repeats until the user “closes” the shell processor by terminating it or exiting the program.
As computers became connected via networking, it became necessary to be able to execute such commands remotely. Accordingly, a number of well-known remote shell protocols were developed (e.g., Telnet, Secure Telnet, Secure Shell etc.), which also function on character-by-character basis as if the keyboard was being remoted, rather than the command processor. Once the shell is opened, the characters flow back and forth and the shell protocol is essentially unaware of when a command is executed, or if indeed any command was ever executed. In other words, the protocols simply pass the input and output characters back and forth. Although this allows an operator to be present in one location and to execute commands against a computer in another, there are a number of efficiency, interoperability, and other problems for such techniques.
For example, since some commands require an input stream to process, there are occasions where this character-by-character approach can result in incorrect behavior. Take for instance, during a failure scenario in which the precise character sequence may be omitted by a command or the shell processor. In such case, input streams may be mistaken for the next command or the next command may be mistaken for an input stream of the previous command. As an example, take a command where input thereto is file. If the return character (e.g., “Enter”) for executing the command is not received before the input characters from the file, one of the input characters (i.e., a return character) within the file may be mistaken for the execution command.
Similarly, even if there is no faulted state (e.g., in the above example the return character is received before the input characters), there are situations wherein the input characters can be mistaken for other commands and or controls of the currently executed command. In other words, because the character-by-character input is not necessarily separated from the character-by-character command and control streams, an input with a character string similar to a command or control string may be mistaken for such function. For instance, if a command is being executed on an input string where one character string is the same as a terminate command sequence (e.g., Ctrl^X, Ctrl^C, etc.), the processing may be mistakenly stopped. Of course, depending on the mistaken input string, other command or control operations may cause even more problematic responses such as relocation or renaming of files, deletion or removal of files, shutdown of the entire system, or other harmful operations.
Still, other problems with current character-by-character protocols for remotely operating a shell process include: (1) mistakes are not recognized early in the processing of a command; and (2) these systems typically are not platform or language agnostic. More specifically, because the client simply acts as an extension of a key board, such clients typically do not know if a command is legal, if and when it is executed, and/or what type of operating system or syntax is used by the shell process. As such, a mistaken command or input is sent over the network wire and not recognized early in the processing cycle. Further, the user needs to know and adjust character usage based on the particular type of protocol employed (e.g., UNIX shell, SSH, etc.) at the remote shell. Accordingly, the above and other drawback and deficiencies of current command-line shell protocols cause efficiency, interoperability, and other various problems.